package com.gjzhao.fmmall.service.impl;

import cn.hutool.core.util.StrUtil;
import com.gjzhao.fmmall.dao.ProductImgMapper;
import com.gjzhao.fmmall.entity.ProductImg;
import com.gjzhao.fmmall.service.ProductImgService;
import com.gjzhao.fmmall.vo.ResponseResultVO;
import com.gjzhao.fmmall.vo.RespCode;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description: 商品图片 ServiceImpl
 * @Author: gjzhao
 * @Date Created in 2022-01-02 1:05 下午
 */
@Service
public class ProductImgServiceImpl implements ProductImgService {

    @Autowired
    private ProductImgMapper productImgMapper;


    /**
     * 查询该商品下所有图片列表
     *
     * @param productId
     * @return
     */
    @Override
    public ResponseResultVO listProductImgByProductId(String productId) {

        if (StrUtil.isBlank(productId)) {
            return new ResponseResultVO(RespCode.FAILED.getCode(), "fail", null);
        } else {
            List<ProductImg> productImgs = productImgMapper.selectProductImgList(productId);
            return new ResponseResultVO(RespCode.SUCCESS.getCode(), "fail", productImgs);
        }
    }
}
